package com.dotflat.survey.domain;

import com.aliyun.openservices.shade.org.apache.commons.lang3.builder.HashCodeExclude;
import com.dotflat.rest.domain.AreableObjectBase;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;

@Entity
@Table(name = "dw_survey_sheet_item")
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel("问卷条目")
public class SurveySheetItem extends AreableObjectBase {

    @Column(columnDefinition = "varchar(32)  COMMENT '问卷id'", nullable = false)
    @ApiModelProperty("问卷id")
    private String sheetId;

    @ManyToOne
    @JoinColumn(name = "sheetId", columnDefinition = "varchar(32) COMMENT '问卷id'", insertable = false, updatable = false)
    @JsonIgnore
    @HashCodeExclude
    @ApiModelProperty(value = "问卷",hidden = true)
    private SurveySheet sheet;

    @Column(columnDefinition = "varchar(32)  COMMENT '标题'", nullable = false)
    @ApiModelProperty("标题")
    private String title;

    @Column(columnDefinition = "varchar(128)  COMMENT '候选项'")
    @ApiModelProperty("候选项,竖线分割。")
    private String options;

    @Column(columnDefinition = "int(3)  COMMENT '序号'", nullable = false)
    @ApiModelProperty("序号")
    private String seq;

    @Column(columnDefinition = "varchar(20) default 'rank5' COMMENT '类型，如text文本, select单选, multiple多选, rank5五星打分'", nullable = false)
    @ApiModelProperty("类型，如text文本, select单选, multiple多选, rank5五星打分")
    private String type;

}
